package com.googlecode.olabs.common;

import java.io.File;
import java.io.IOException;

import junit.framework.TestCase;

public class FileHelper {

	/**
	 * @param relativeFilePath
	 *            A file path relative to src/test/resources/ for this project
	 * @return a File object only if it actually exists
	 * @throws IOException
	 */
	public static File getTestFile(String relativeFilePath) throws IOException {
		File sourceFile = new File("src/test/resources/" + relativeFilePath);
		TestCase.assertTrue("Expecting test file: "
				+ sourceFile.getCanonicalFile(), sourceFile.exists());
		return sourceFile;
	}
}
